<template>
	<div class="swiper-box">
		<swiper :options="swiperOption" v-if="showSwiper">
		    <!-- slides -->
		    <swiper-slide v-for="item of list" :key="item.id"><img :src="item.imgUrl"/></swiper-slide>
		    <div class="swiper-pagination"  slot="pagination"></div>
		</swiper>
	</div>
</template>

<script>
	export default {
		name:'HomeSwiper',
		props:{
			list:Array
		},
		data(){
			return {
				swiperOption:{
					//小点
					pagination:'.swiper-pagination',
					//循环轮播
					loop:true,
					autoplay:3000,
					speed:1000
				}
			} 
		},
		computed:{
			showSwiper(){
				return this.list.length
			}
		}
	}
</script>

<style scoped="scoped">
	.swiper-box{
		width: 100%;
		overflow: hidden;
	}
	.swiper-slide img{
		width: 100%;
		height: 100%;
	}
</style>